import http from './index';

// 小程序登录
const wxLogin = (p) => {
    return http.get("/user/wxLogin", p);
};

// 更新用户信息
const updateUserInfo = (p) => {
    return http.put('/user/update', p)
}

// 获取工作人员token
const getWorkToken = (p) => {
    return http.get('/user/workToken', p)
}

// 获取商品列表
const getGoodsList = (p) => {
    return http.get('/goods/list', p)
}

// 支付/提交订单
const openBuy = (p) => {
    return http.post('/order/transactions', p)
}

// 获取支付结果
const getPayRes = (p) => {
    return http.get('/order/queryTransaction', p)
}

// 获取订单列表
const getOrderList = (p) => {
    return http.get('/order/list', p)
}

// 获取预约列表
const getBookList = (p) => {
    return http.get('/book/list', p)
}

// 退款
const orderRefund = (p) => {
    return http.get('/order/refund', p)
}

// 提交预约
const createBook = (p) => {
    return http.post('/book/create', p)
}

// 预约核销
const bookVerification = (p) => {
    return http.get('/book/verification', p)
}

// 订单核销
const orderVerification = (p) => {
    return http.get('/order/verification', p)
}

// 获取手机号
const getPhone = (p) => {
    return http.get('/user/getuserphonenumber', p)
}

// 取消预约
const cancelBook = (p) => {
    return http.post('/book/cancel', p)
}

// 线下预约
const createOfflineBook = (p) => {
    return http.post('/book1/create', p)
}
// 线下预约列表
const getOfflineList = (p) => {
    return http.post('/book1/list', p)
}
// 线下预约核销
const offlineVerification = (p) => {
    return http.get('/book1/verification', p)
}

// 预约详情
const getBookDetail = (p) => {
    return http.get('/book/detail', p)
}

// 线下预约详情
const getOfflineDetail = (p) => {
    return http.get('/book1/detail', p)
}

// 订单详情
const getOrderDetail = (p) => {
    return http.get('/order/detail', p)
}

// 预约时间
const getBookTime = (p) => {
    return http.get('/date/list', p)
}

export default {
    wxLogin,
    updateUserInfo,
    getWorkToken,
    getGoodsList,
    openBuy,
    getPayRes,
    getOrderList,
    getBookList,
    orderRefund,
    createBook,
    bookVerification,
    orderVerification,
    getPhone,
    cancelBook,
    createOfflineBook,
    getOfflineList,
    offlineVerification,
    getBookDetail,
    getOfflineDetail,
    getOrderDetail,
    getBookTime
}